package org.example.chat.dao;

import org.example.chat.entity.ChatMessage;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author cheval
 */
@Repository
@Transactional
public interface ChatMessageRepository extends JpaRepository<ChatMessage, String> {

    @Modifying
    @Query(value = "update #{#entityName} t set t.signFlag = 1 where t.id in (:ids)")
    int batchUpdateSignFlag(@Param("ids") String[] messageIds);
}
